3.1.47 \(\int \frac {\tan ^4(c+d x)}{a+i a \tan (c+d x)} \, dx\) [47]

Optimal. Leaf size=90 \[ -\frac {3 x}{2 a}-\frac {2 i \log (\cos (c+d x))}{a d}+\frac {3 \tan (c+d x)}{2 a d}-\frac {i \tan ^2(c+d x)}{a d}-\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))} \]

[Out]

-3/2*x/a-2*I*ln(cos(d*x+c))/a/d+3/2*tan(d*x+c)/a/d-I*tan(d*x+c)^2/a/d-1/2*tan(d*x+c)^3/d/(a+I*a*tan(d*x+c))

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 90, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3631, 3609, 3606, 3556} \begin {gather*} -\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {i \tan ^2(c+d x)}{a d}+\frac {3 \tan (c+d x)}{2 a d}-\frac {2 i \log (\cos (c+d x))}{a d}-\frac {3 x}{2 a} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Tan[c + d*x]^4/(a + I*a*Tan[c + d*x]),x]

[Out]

(-3*x)/(2*a) - ((2*I)*Log[Cos[c + d*x]])/(a*d) + (3*Tan[c + d*x])/(2*a*d) - (I*Tan[c + d*x]^2)/(a*d) - Tan[c +
 d*x]^3/(2*d*(a + I*a*Tan[c + d*x]))

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3606

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[b*d*(Tan[e + f*x]/f), x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3609

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*
((a + b*Tan[e + f*x])^m/(f*m)), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3631

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*
c - a*d)*((c + d*Tan[e + f*x])^(n - 1)/(2*a*f*(a + b*Tan[e + f*x]))), x] + Dist[1/(2*a^2), Int[(c + d*Tan[e +
f*x])^(n - 2)*Simp[a*c^2 + a*d^2*(n - 1) - b*c*d*n - d*(a*c*(n - 2) + b*d*n)*Tan[e + f*x], x], x], x] /; FreeQ
[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && GtQ[n, 1]

Rubi steps

\begin {align*} \int \frac {\tan ^4(c+d x)}{a+i a \tan (c+d x)} \, dx &=-\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \tan ^2(c+d x) (3 a-4 i a \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac {i \tan ^2(c+d x)}{a d}-\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \tan (c+d x) (4 i a+3 a \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac {3 x}{2 a}+\frac {3 \tan (c+d x)}{2 a d}-\frac {i \tan ^2(c+d x)}{a d}-\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {(2 i) \int \tan (c+d x) \, dx}{a}\\ &=-\frac {3 x}{2 a}-\frac {2 i \log (\cos (c+d x))}{a d}+\frac {3 \tan (c+d x)}{2 a d}-\frac {i \tan ^2(c+d x)}{a d}-\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(196\) vs. \(2(90)=180\).
time = 1.98, size = 196, normalized size = 2.18 \begin {gather*} \frac {\cos (c) \sec (c+d x) (\cos (d x)+i \sin (d x)) \left (-6 d x-4 i \log \left (\cos ^2(c+d x)\right )+8 d x \sec ^2(c)-2 i \sec ^2(c+d x)+4 \sec (c) \sec (c+d x) \sin (d x)+\sin (2 d x)+\text {ArcTan}(\tan (d x)) (-8-8 i \tan (c))+2 i d x \tan (c)+4 \log \left (\cos ^2(c+d x)\right ) \tan (c)+2 \sec ^2(c+d x) \tan (c)+4 i \sec (c) \sec (c+d x) \sin (d x) \tan (c)-i \sin (2 d x) \tan (c)-8 d x \tan ^2(c)+\cos (2 d x) (i+\tan (c))\right )}{4 d (a+i a \tan (c+d x))} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Tan[c + d*x]^4/(a + I*a*Tan[c + d*x]),x]

[Out]

(Cos[c]*Sec[c + d*x]*(Cos[d*x] + I*Sin[d*x])*(-6*d*x - (4*I)*Log[Cos[c + d*x]^2] + 8*d*x*Sec[c]^2 - (2*I)*Sec[
c + d*x]^2 + 4*Sec[c]*Sec[c + d*x]*Sin[d*x] + Sin[2*d*x] + ArcTan[Tan[d*x]]*(-8 - (8*I)*Tan[c]) + (2*I)*d*x*Ta
n[c] + 4*Log[Cos[c + d*x]^2]*Tan[c] + 2*Sec[c + d*x]^2*Tan[c] + (4*I)*Sec[c]*Sec[c + d*x]*Sin[d*x]*Tan[c] - I*
Sin[2*d*x]*Tan[c] - 8*d*x*Tan[c]^2 + Cos[2*d*x]*(I + Tan[c])))/(4*d*(a + I*a*Tan[c + d*x]))

________________________________________________________________________________________

Maple [A]
time = 0.10, size = 65, normalized size = 0.72

method result size
derivativedivides \(\frac {\tan \left (d x +c \right )-\frac {i \left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {7 i \ln \left (\tan \left (d x +c \right )-i\right )}{4}+\frac {1}{2 \tan \left (d x +c \right )-2 i}+\frac {i \ln \left (\tan \left (d x +c \right )+i\right )}{4}}{d a}\) \(65\)
default \(\frac {\tan \left (d x +c \right )-\frac {i \left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {7 i \ln \left (\tan \left (d x +c \right )-i\right )}{4}+\frac {1}{2 \tan \left (d x +c \right )-2 i}+\frac {i \ln \left (\tan \left (d x +c \right )+i\right )}{4}}{d a}\) \(65\)
risch \(-\frac {7 x}{2 a}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )}}{4 d a}-\frac {4 c}{d a}+\frac {2 i}{d a \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {2 i \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d a}\) \(78\)
norman \(\frac {\frac {i}{d a}+\frac {\tan ^{3}\left (d x +c \right )}{d a}-\frac {3 x}{2 a}-\frac {3 x \left (\tan ^{2}\left (d x +c \right )\right )}{2 a}+\frac {3 \tan \left (d x +c \right )}{2 d a}-\frac {i \left (\tan ^{4}\left (d x +c \right )\right )}{2 d a}}{1+\tan ^{2}\left (d x +c \right )}+\frac {i \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d a}\) \(111\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)^4/(a+I*a*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d/a*(tan(d*x+c)-1/2*I*tan(d*x+c)^2+7/4*I*ln(tan(d*x+c)-I)+1/2/(tan(d*x+c)-I)+1/4*I*ln(tan(d*x+c)+I))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^4/(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

Fricas [A]
time = 0.38, size = 138, normalized size = 1.53 \begin {gather*} -\frac {14 \, d x e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (28 \, d x - i\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, {\left (7 \, d x - 5 i\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 8 \, {\left (i \, e^{\left (6 i \, d x + 6 i \, c\right )} + 2 i \, e^{\left (4 i \, d x + 4 i \, c\right )} + i \, e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - i}{4 \, {\left (a d e^{\left (6 i \, d x + 6 i \, c\right )} + 2 \, a d e^{\left (4 i \, d x + 4 i \, c\right )} + a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^4/(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

-1/4*(14*d*x*e^(6*I*d*x + 6*I*c) + (28*d*x - I)*e^(4*I*d*x + 4*I*c) + 2*(7*d*x - 5*I)*e^(2*I*d*x + 2*I*c) + 8*
(I*e^(6*I*d*x + 6*I*c) + 2*I*e^(4*I*d*x + 4*I*c) + I*e^(2*I*d*x + 2*I*c))*log(e^(2*I*d*x + 2*I*c) + 1) - I)/(a
*d*e^(6*I*d*x + 6*I*c) + 2*a*d*e^(4*I*d*x + 4*I*c) + a*d*e^(2*I*d*x + 2*I*c))

________________________________________________________________________________________

Sympy [A]
time = 0.23, size = 134, normalized size = 1.49 \begin {gather*} \begin {cases} \frac {i e^{- 2 i c} e^{- 2 i d x}}{4 a d} & \text {for}\: a d e^{2 i c} \neq 0 \\x \left (\frac {\left (1 - 7 e^{2 i c}\right ) e^{- 2 i c}}{2 a} + \frac {7}{2 a}\right ) & \text {otherwise} \end {cases} + \frac {2 i}{a d e^{4 i c} e^{4 i d x} + 2 a d e^{2 i c} e^{2 i d x} + a d} - \frac {7 x}{2 a} - \frac {2 i \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)**4/(a+I*a*tan(d*x+c)),x)

[Out]

Piecewise((I*exp(-2*I*c)*exp(-2*I*d*x)/(4*a*d), Ne(a*d*exp(2*I*c), 0)), (x*((1 - 7*exp(2*I*c))*exp(-2*I*c)/(2*
a) + 7/(2*a)), True)) + 2*I/(a*d*exp(4*I*c)*exp(4*I*d*x) + 2*a*d*exp(2*I*c)*exp(2*I*d*x) + a*d) - 7*x/(2*a) -
2*I*log(exp(2*I*d*x) + exp(-2*I*c))/(a*d)

________________________________________________________________________________________

Giac [A]
time = 0.97, size = 87, normalized size = 0.97 \begin {gather*} -\frac {-\frac {7 i \, \log \left (\tan \left (d x + c\right ) - i\right )}{a} - \frac {i \, \log \left (-i \, \tan \left (d x + c\right ) + 1\right )}{a} + \frac {2 \, {\left (i \, a \tan \left (d x + c\right )^{2} - 2 \, a \tan \left (d x + c\right )\right )}}{a^{2}} - \frac {-7 i \, \tan \left (d x + c\right ) - 5}{a {\left (\tan \left (d x + c\right ) - i\right )}}}{4 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^4/(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/4*(-7*I*log(tan(d*x + c) - I)/a - I*log(-I*tan(d*x + c) + 1)/a + 2*(I*a*tan(d*x + c)^2 - 2*a*tan(d*x + c))/
a^2 - (-7*I*tan(d*x + c) - 5)/(a*(tan(d*x + c) - I)))/d

________________________________________________________________________________________

Mupad [B]
time = 4.01, size = 91, normalized size = 1.01 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,7{}\mathrm {i}}{4\,a\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{4\,a\,d}+\frac {\mathrm {tan}\left (c+d\,x\right )}{a\,d}+\frac {1{}\mathrm {i}}{2\,a\,d\,\left (1+\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,1{}\mathrm {i}}{2\,a\,d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(c + d*x)^4/(a + a*tan(c + d*x)*1i),x)

[Out]

(log(tan(c + d*x) - 1i)*7i)/(4*a*d) + (log(tan(c + d*x) + 1i)*1i)/(4*a*d) + tan(c + d*x)/(a*d) + 1i/(2*a*d*(ta
n(c + d*x)*1i + 1)) - (tan(c + d*x)^2*1i)/(2*a*d)

________________________________________________________________________________________